package com.admin.servlet;

import com.admin.dao.advertDao;
import com.admin.dao.flightDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.File;
import java.io.IOException;


public class advertRemoveServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        String advertId=request.getParameter("advertId");
        System.out.println(advertId);
        boolean advert= new advertDao().deleteAdvert(advertId);
        response.sendRedirect(request.getContextPath()+"/admin/advertSearchServlet");
        //TODO 本地文件删除，建议做一个定时任务，匹配删除本地图片
    }
}
